package com.gitee.ywj1352.reactive;

import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;

public class ZKSimplePublisher implements Publisher<Integer> {

    private Subscriber sb;
    private ZKSampleSubscription subscription;

    @Override
    public void subscribe(Subscriber<? super Integer> s) {
        System.out.println("SimplePublisher#subscribe :" + s.getClass());
        subscription = new ZKSampleSubscription(new DecoratingSubscriber(s));
        s.onSubscribe(subscription);
        sb = s;
    }

    public  void cannel(){
        subscription.cancel();
    }

}
